﻿@model Fcom.VNInsurance.Web.Models.CoverageExtentBenefit
@{
    ViewBag.Title = "AddExtenBenefitCoverage";
    Layout = "~/Views/Shared/_CpanelLayout.cshtml";
    var Coverage = (Fcom.VNInsurance.Web.Models.Coverage)ViewBag.Coverage;
    var coveageextent = (IEnumerable<Fcom.VNInsurance.Web.Models.Coverage>)ViewBag.CoverageOther;
    var benefits = (IEnumerable<Fcom.VNInsurance.Web.Models.BenefitLang>)ViewBag.Benefits;
}
<p>Quyền lợi bổ sung trong nhóm: <strong>@Coverage.Name</strong></p>
<div class="container">
    <form method="post">
        @Html.Hidden("CoverageID",Coverage.ID)
        Nhóm quyền lợi khác:
        @Html.DropDownList("slothercoverage",new SelectList(coveageextent,"ID","Name"),new{id="slothercoverage"})<br />

       Quyền lợi: @Html.DropDownList("BenefitID",new SelectList(benefits,"BenefitID","DisplayName"),new{id="BenefitID"})<br />
        @Html.Hidden("isAdded",true)
        <input type="submit"  value="Thêm"/>
    </form>

</div>
<script>
    $(document).ready(function () {
        $("#slothercoverage").change(function () {
            //------------------------------------
            $.ajax({
                type: "post",
                data: { ID: $(this).val() },
                datatype: "json",
                url:"@Url.Action("jsonBenefitbyCoverage", "Coverage")",
                success: function (rvdata) {
                    var html = '';
                    $(rvdata).each(function (index, item) {
                        html += "<option value='"+item.BenefitID+"'>"+item.DisplayName+"</option>";
                    });
                    $("#BenefitID").html(html);
                }
            });
            return false;//----------------------
        });
    });
</script>